import request from "../utils/request"

// 获取分钟天气数据
// export function getMinutelyWeather(latitude,longitude,minutes) {
//     return request({
//         url:`/minutelyWeather?latitude=${latitude}&longitude=${longitude}&minutes=${minutes}`
//     })
// }


/**
 * 获取实时天气
 * @returns 
 */
export function getMinutelyWeather() {
    var promise = new Promise((resolve,reject)=>{
        request({
            url:'/getWeatherData',
            methods:"get",
            params:{productType:"CURRENT_WEATHER"}
        }).then((res)=>{
            if(res.status==200){resolve(JSON.parse(res.data))}else{console.log('请求错误',res); reject(false)}
        }).catch(error=>{console.log(error);reject(false)})
    })
    return promise  
}


// 获取一周数据
export function get7DaysWeatherData(latitude, longitude, days) {
    return request({
        url:`/dailyWeather?latitude=${latitude}&longitude=${longitude}&days=${days}`
    })
}
 